#pragma once

#include <string>
#include <iostream>
#include <unistd.h>
#include <functional>

using cb_t = std::function<void(int, const std::string&, const uint16_t&)>;

class Task
{
public:
    Task()
    {
    }
    Task(int sock, const std::string& ip, const uint16_t port, cb_t cb) 
        :_sock(sock)
        ,_ip(ip)
        ,_port(port)
        ,_cb(cb)
    {
    }
    void operator()()
    {
        _cb(_sock, _ip, _port);
    }
    ~Task()
    {
    }
private:
    int _sock;
    std::string _ip;
    std::uint16_t _port;
    cb_t _cb;
};
